# Maintainer: Luca Weiss <luca@z3ntu.xyz>
pkgname=py3-pyside6
pkgver=6.3.1
pkgrel=0
pkgdesc="Enables the use of Qt6 APIs in Python applications"
url="https://doc.qt.io/qtforpython-6/"
arch="all"
license="LGPL-3.0-only AND GPL-2.0-only"
depends="py3-shiboken6"
makedepends="
	cmake
	ninja
	libshiboken6-dev
	py3-shiboken6
	qt6-qt3d-dev
	qt6-qtbase-dev
	qt6-qtcharts-dev
	qt6-qtconnectivity-dev
	qt6-qtdatavis3d-dev
	qt6-qtdeclarative-dev
	qt6-qtpositioning-dev
	qt6-qtmultimedia-dev
	qt6-qtnetworkauth-dev
	qt6-qtremoteobjects-dev
	qt6-qtscxml-dev
	qt6-qtsensors-dev
	qt6-qtserialport-dev
	qt6-qtsvg-dev
	qt6-qttools-dev
	qt6-qtwebchannel-dev
	qt6-qtwebsockets-dev
	samurai
	shiboken6
	py3-setuptools
	py3-wheel
	"
subpackages="$pkgname-dev"
source="https://download.qt.io/official_releases/QtForPython/pyside6/PySide6-$pkgver-src/pyside-setup-opensource-src-$pkgver.tar.xz"
builddir="$srcdir/pyside-setup-opensource-src-$pkgver"
options="!check" # Tests fail

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SHARED_LIBS=True \
		-DPYTHON_EXECUTABLE=/usr/bin/python3 \
		-DBUILD_TESTS=OFF \
		sources/pyside6
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	# Install egg info
	export PATH="/usr/lib/qt6/bin:$PATH"
	python3 setup.py egg_info --build-type=pyside6
	pythonpath="$(python3 -c "from sysconfig import get_path; print(get_path('platlib'))")"
	cp -r PySide6.egg-info "$pkgdir/$pythonpath"
}

sha512sums="
81751fa9e2c492ceae42b3cb1f871d3f95f56cc07c382f02574899f3eab8db52453b0b636e63d53e0d2195f1686a01ad2bee20953aa0a8237719ec06d2b6e321  pyside-setup-opensource-src-6.3.1.tar.xz
"
